﻿<!--#include file="h.asp"--><%
'
'	七色虎建站系统
'	评论页面
'	2012.4.5

Sub main
	Dim p,rs,id,userid,body_,pl,authorid,sql
	Dim formarray(2)
	body_=""
	id=getN("id",1)
	p=getN("p",1)
	userid=user_array(0)
	hu.title = "网友跟贴"
	body_ = checkMsg()'信息
	body_ = body_ & "[div=nav]-" & hu.url("?aid=index","首页" )&"-"
	if id<>0 then
		body_ = body_ & hu.url("article.asp?id="&id&"&amp;p="&p, "查看原文") & "-跟贴[/div]"
		If wapDiscuss=1 And userid=0 Then
			body_ = body_ & hu.url("bbs_login.asp?_u="&back_url, "登录评论文章") &"<br/>"
		Else
			formarray(0) = http_path&"comment.asp||post||提交"
			formarray(1) = "input||pl$$$$20$$200||<br/>"
			formarray(2) = "hidden||id$$"&id&"||p$$"&p&"||"&bbsSid&"$$"&sid&"||"
			body_ = body_ & "发表评论：<br/>" & hu.getForm(formarray) &" (支持"&hu.url("bbs_reply.asp?a=-1","UBB")&")<br/>"
		End If
		body_ = body_ & "[div=nav]※网友评论区[/div]"
	Else
		body_ = body_ & "网站群聊[/div]"
		If wapDiscuss=1 And userid=0 Then
			body_ = body_ & hu.url("bbs_login.asp?_u="&back_url, "登录一起群聊") &"<br/>"
		Else
			formarray(0) = http_path&"comment.asp||post||提交"
			formarray(1) = "input||pl$$$$20$$200||<br/>"
			formarray(2) = "hidden||id$$"&id&"||p$$"&p&"||"&bbsSid&"$$"&sid&"||"
			body_ = body_ & "发表群聊：<br/>" & hu.getForm(formarray) &" (支持"&hu.url("bbs_reply.asp?a=-1","UBB")&")<br/>"
		End If
		body_ = body_ & "[div=nav]※网友群聊区[/div]"
	End If
	sql = "select pl,pltime,ip from 74hu_pl where smsid="&id&" order by id desc"
	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.open sql, hu.db, 1, 1
	If Not rs.eof Then
		Dim PageSize,page,i,pagecount,ip,count,tid
		PageSize=8
		page=getN("page",1)
		page=int(page)
		if page<=0 then page=1
		count = rs.recordcount
		pagecount=(count+pagesize-1)\pagesize
		if page>pagecount Then page=pagecount
		rs.move(pagesize*(page-1))
		tid=count-(page-1)*pagesize
		For i=1 To PageSize
			If rs.eof Then Exit For
			ip=rs("ip")
			pl=rs("pl")
			If ip<>"" And IsNumeric(ip) Then
				authorid = ip
				ip=hu.url("bbs_user.asp?id="&authorid, getUserName(authorid))
				If Not ifUserNormal(authorid) Then pl = "用户信息被系统屏蔽"
			Else
				ip="网友"
			End If
			body_ = body_ & "[div=odd]"&tid&"楼."&ip &" "& fordate2(rs("pltime"))&"[/div][div=even]"& discussUbb(noad(pl))&"[/div]"
			tid=tid-1
			rs.moveNext
		Next
		body_ = body_ & showPage("discuss.asp", "p:"&p&",id:"&id, page, pagecount)&""
	Else
		body_ = body_ & "暂时没有评论！<br/>"
	end if
	rs.close
	set rs=nothing
	if id<>0 Then
		set rs=hu.conn("select top 1 classid from 74hu_article where id="&id&"")
		if not rs.eof then
			body_ = body_ & "[div=nav]"& hu.url("article.asp?id="&id&"&amp;p="&p, "返回原文")& " " &_
				hu.url("list.asp?id="&rs("classid"), "返回上级栏目") &"[/div]"
		end if
		set rs=nothing
	end if
	hu.body = comUbb(body_)
End Sub
%>